package cn.unknowpupil.init.configure.threads;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Description: 描述。</br>
 * <p>
 *     异常工具
 *
 * </p>
 * @author: <a> w10g </a>
 * @data: 2020/7/29 10:53
 * @since: 0.0.2
 */
public class ThrowableUtil {
    /**
     * 获取堆栈信息
     */
    public static String getStackTrace(Throwable throwable){
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
